﻿using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Logging;
using NLog.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;

namespace LXD.StudnetMangement
{
    public class Program
    {
        //这是netCore 主入口
        public static void Main(string[] args)
        {
            //Build 编译服务器托管 
            //Run 接受客户端的请求 用这个方法
            CreateWebHostBuilder(args)
                .Build() //生成配置
                .Run();  //运行
        }


        public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
            WebHost.CreateDefaultBuilder(args).ConfigureLogging((hostingContext, logging) =>
                                               {
                                                   //Nlog日志配置
                                                   logging.AddConfiguration(hostingContext.Configuration.GetSection("Logging"));
                                                   logging.AddConsole();
                                                   logging.AddDebug();
                                                   logging.AddEventSourceLogger();
                                                   //启用Nlog作为日志程序之一
                                                   logging.AddNLog();
                                               })
                .UseStartup<Startup>();    // 业务逻辑判断，中间件一种形式    
    }
}
